From: Jimi Xenidis Date: Fri, 1 Sep 2006 16:31:56 +0000 (-0400) Subject: [POWERPC][XEN] move idle_loop and add a "power save" hook X-Git-Tag: archive/raspbian/4.8.0-1+rpi1~1^2~15658^2~88 X-Git-Url: https://dgit.raspbian.org/%22http:/www.example.com/cgi/%22https:/%22bookmarks://%22Dat/%22http:/www.example.com/cgi/%22https:/%22bookmarks:/%22Dat?a=commitdiff_plain;h=08a4d9132867ceda66c1229fa6532851e8b34c32;p=xen.git [POWERPC][XEN] move idle_loop and add a "power save" hook Signed-off-by: Jimi Xenidis Signed-off-by: Hollis Blanchard --- diff --git a/xen/arch/powerpc/domain.c b/xen/arch/powerpc/domain.c index 77df5a613f..58a0cfa129 100644 --- a/xen/arch/powerpc/domain.c +++ b/xen/arch/powerpc/domain.c @@ -29,12 +29,11 @@ #include #include #include +#include #include #include #include -extern void idle_loop(void); - #define next_arg(fmt, args) ({ \ unsigned long __arg; \ switch ( *(fmt)++ ) \ @@ -47,6 +46,7 @@ extern void idle_loop(void); } \ __arg; \ }) +extern void idle_loop(void); unsigned long hypercall_create_continuation(unsigned int op, const char *format, ...) @@ -179,7 +179,6 @@ void dump_pageframe_info(struct domain *d) } } - void context_switch(struct vcpu *prev, struct vcpu *next) { struct cpu_user_regs *stack_regs = guest_cpu_user_regs(); @@ -253,3 +252,30 @@ void domain_relinquish_resources(struct domain *d) void arch_dump_domain_info(struct domain *d) { } + +extern void sleep(void); +static void safe_halt(void) +{ + int cpu = smp_processor_id(); + + while (!softirq_pending(cpu)) + sleep(); +} + +static void default_idle(void) +{ + local_irq_disable(); + if ( !softirq_pending(smp_processor_id()) ) + safe_halt(); + else + local_irq_enable(); +} + +void idle_loop(void) +{ + for ( ; ; ) { + page_scrub_schedule_work(); + default_idle(); + do_softirq(); + } +} diff --git a/xen/arch/powerpc/setup.c b/xen/arch/powerpc/setup.c index ea11b01c8d..59c17f2492 100644 --- a/xen/arch/powerpc/setup.c +++ b/xen/arch/powerpc/setup.c @@ -82,7 +82,6 @@ ulong isa_io_base; struct ns16550_defaults ns16550; extern char __per_cpu_start[], __per_cpu_data_end[], __per_cpu_end[]; -extern void idle_loop(void); /* move us to a header file */ extern void initialize_keytable(void); @@ -102,21 +101,6 @@ unsigned long kernel_text_end(void) return (unsigned long) &_etext; } -void idle_loop(void) -{ - int cpu = smp_processor_id(); - - for ( ; ; ) - { - while (!softirq_pending(cpu)) { - void sleep(void); - page_scrub_schedule_work(); - sleep(); - } - do_softirq(); - } -} - static void __init do_initcalls(void) { initcall_t *call; @@ -210,6 +194,8 @@ static void __init start_of_day(void) schedulers_start(); } +extern void idle_loop(void); + void startup_cpu_idle_loop(void) { struct vcpu *v = current;